'use strict';
/**
 * logic
 * @param  {} []
 * @return {}     []
 */
export default class extends think.logic.base {
  /**
   * index action logic
   * @return {} []
   */
  loginAction(){
    let user=this.post()
    let rules = {
      phone: 'mobile:zh-CN' //必须为中国的手机号
    }
    let flag = this.validate(rules);
    if(!flag){
      return this.fail(102);
      //如果出错，返回值格式为：{"errno":1000,"errmsg":"validate error","data":{"mobile_number":"mobile_number need is a mobile phone number"}}
    }
  }

  registerAction(){
    let user=this.post()
    let rules = {
      name: 'required',
      phone: 'mobile:zh-CN',
      code: 'required',
      password:'required',
      city:'required'
    }
    let flag = this.validate(rules);
    if(!flag){
      return this.fail(107);
    }
  }

  smsAction(){
     let user=this.post()
    let rules = {
      phone: 'mobile:zh-CN' //必须为中国的手机号
    }
    let flag = this.validate(rules);
    if(!flag){
      return this.fail(102);
    }
  }
}
